package com.orange.base.component.biztool.simulateddata.service.impl;

import com.orange.base.component.biztool.simulateddata.service.SimulatedDataEnum;
import com.orange.base.component.biztool.simulateddata.service.SimulatedDataParam;

/**
 * 生成手机号
 *
 * @author biankudingcha
 * @date: 2022-08-24
 * @since 0.5.0
 */
public class MobileStrategy extends AbstractSimulatedData {

    public String getType() {
        return SimulatedDataEnum.MOBILE.getName();
    }

    public String getCaption() {
        return SimulatedDataEnum.MOBILE.getCaption();
    }

    private static final String[] telFirst = "134,135,136,137,138,139,150,151,152,157,158,159,130,131,132,155,156,133,153"
        .split(",");

    @Override
    public Object getValue(SimulatedDataParam param) {
        return generate(param);
    }

    private static String generate(SimulatedDataParam param) {
        int index = getRandomNumber(0, telFirst.length - 1);
        String first = telFirst[index];
        return first + randomNumbers(8);
    }

}
